package com.ruoyi.app.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.app.domain.dto.AdvertisingSettingDto
import com.ruoyi.app.domain.vo.*
import com.ruoyi.app.service.IndexApiService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("api/index")
@Api(tags = ["首页相关接口"])
class IndexApiController {

    @Autowired
    private lateinit var indexApiService: IndexApiService


    @ApiOperation("获取首页轮播列表")
    @GetMapping("getBannerList")
    fun getBannerList(): Data<List<IndexApiService.WonderfulRecordVo>> = indexApiService.getBannerList()


    @ApiOperation("获取精彩创作列表")
    @GetMapping("wonderfulRecord")
    fun wonderfulRecord(pageNum: Long? = 1, pageSize: Long? = 10): Data<PageData<IndexApiService.WonderfulRecordVo>> =
        indexApiService.wonderfulRecord(pageNum, pageSize)


    @ApiOperation("获取广告配置参数")
    @GetMapping("getAdvertisingSetting")
    fun getAdvertisingSetting(advertisingSettingDto: AdvertisingSettingDto): Data<AdvertisingSettingVo> =
        indexApiService.getAdvertisingSetting(advertisingSettingDto)


    @ApiOperation("获取全局参数配置")
    @GetMapping("getGlobalSetting")
    fun getGlobalSetting(): Data<GlobalSetting> = indexApiService.getGlobalSetting()


    @ApiOperation("获取ios全局参数配置")
    @GetMapping("getIosGlobalSetting")
    fun getIosGlobalSetting(): Data<GlobalSetting> = indexApiService.getIosGlobalSetting()
}